package net.ojbk.study.curriculumDesign.beans.cilentservicer;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: twobox
 * Date: 2019/1/10
 * Time: 16:04
 * Description: No Description
 */
public class RequestChat {
    private String cuserUid;
    private String cuserName;
    private String suserUid;
    private String suserName;
    int Status;
    private Date beginTime;


    /**
     * 返回带接受客服对象时用。
     *
     * @param chat
     * @return
     */
    public static RequestChat getRequestChat(Chat chat) throws Exception {
        if (chat == null)
            throw new Exception("此会话为null");
//        if (chat.getServicer() != null)
//            throw new Exception("此会话已经是通话中的。");
        return new RequestChat(chat.getCuser().getUid(), chat.getCuser().getUname(), chat.getStatus(), chat.getBeginTime());
    }

    public static RequestChat getChating(Chat chat) throws Exception {
        if (chat == null)
            throw new Exception("此会话为null");
//        if (chat.getServicer() != null)
//            throw new Exception("此会话还是待连接状态。");
        return new RequestChat(chat.getCuser().getUid(), chat.getCuser().getUname(), chat.getServicer().getUid(), chat.getServicer().getName(), chat.getStatus(), chat.getBeginTime());
    }


    // 以上为功能区

    public RequestChat(String cuserUid, String cuserName, String suserUid, String suserName, int status, Date beginTime) {
        this.cuserUid = cuserUid;
        this.cuserName = cuserName;
        this.suserUid = suserUid;
        this.suserName = suserName;
        Status = status;
        this.beginTime = beginTime;
    }

    public RequestChat(String cuserUid, String cuserName, int status, Date beginTime) {
        this.cuserUid = cuserUid;
        Status = status;
        this.beginTime = beginTime;
    }

    public String getCuserUid() {
        return cuserUid;
    }

    public void setCuserUid(String cuserUid) {
        this.cuserUid = cuserUid;
    }

    public String getCuserName() {
        return cuserName;
    }

    public void setCuserName(String cuserName) {
        this.cuserName = cuserName;
    }

    public String getSuserUid() {
        return suserUid;
    }

    public void setSuserUid(String suserUid) {
        this.suserUid = suserUid;
    }

    public String getSuserName() {
        return suserName;
    }

    public void setSuserName(String suserName) {
        this.suserName = suserName;
    }

    public int getStatus() {
        return Status;
    }

    public void setStatus(int status) {
        Status = status;
    }

    public Date getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(Date beginTime) {
        this.beginTime = beginTime;
    }

    @Override
    public String toString() {
        return "RequestChat{" +
                "cuserUid='" + cuserUid + '\'' +
                ", cuserName='" + cuserName + '\'' +
                ", suserUid='" + suserUid + '\'' +
                ", suserName='" + suserName + '\'' +
                ", Status=" + Status +
                ", beginTime=" + beginTime +
                '}';
    }
}
